#include <iostream>
#include <unistd.h>
#include <netdb.h>
#include <errno.h>
using namespace std; 


int main(){
/*
	struct servent* s; 
	setservent(1); 
	while((s=getservent())!=NULL){
		cout << s->s_name <<":" << s->s_port << endl; 
	}
	endservent();
	*/
	struct addrinfo *aip,*ailist;
	struct sockaddr_in *sinp; 
	const char *addr; 
	int err; 
	if((err = getaddrinfo("lifelong0811","http",NULL,&ailist))!=0)
		cout << gai_strerror(err);
	for(aip = ailist; aip !=NULL ; aip = aip->ai_next){
		cout << aip->ai_protocol << " : " << 
			aip->ai_family << " : " << 
			aip->ai_canonname       << 
			endl; 
	}

}
